package thread;

public class Demo3 {

	public static void main(String[] args) {
		Thread t6 = new Thread(new Runnable() {

			@Override
			public void run() {
				for (int i = 0; i < 10; i++) {
					System.out.println("t6==>" + i);
				}
				System.out.println("t6 over");

			}
		});
		Thread t5 = new Thread(new Runnable() {

			@Override
			public void run() {
				int i = 0;
				while (i < 100) {
					System.out.println("t5" +" "+ i +" "+ "t6=>" + t6.getState());
					i++;
					try {
//						Thread.sleep(1);
					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}

			}
		});

//		t5.setPriority(1);
//		t6.setPriority(9);
		t5.setDaemon(true);//设置守护线程的，在其他线程结束后也自动结束
		t5.start();
		
		t6.start();
	}
}
